package com.xyz.cinema.util;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtil {
	private final static DateFormat df = new SimpleDateFormat("yyyy/MM/dd");
	
	public static Date strToUtilDate(String str){
		try {
			return df.parse(str);
		} catch (ParseException e) {
			e.printStackTrace();
		}
		return null;
	}
	
	public static String utilDateToStr(Date date){
		return df.format(date);
	}
	
	public static java.sql.Date utilDateToSqlDate(Date date){
		return new java.sql.Date(date.getTime());
	}
	
}
